// 2025/3/19
// https://leetcode.cn/problems/subsets/description/?envType=study-plan-v2&envId=top-100-liked
// 子集

class Solution {
    public:
        vector<int> tmp;
        vector<vector<int>> ans;
    
        void dfs(vector<int>& nums, int i)
        {
            if(i == nums.size())
            {
                ans.emplace_back(tmp);
                return;
            }
    
            dfs(nums, i + 1);
            tmp.emplace_back(nums[i]);
            dfs(nums, i + 1);
            tmp.pop_back();
        }
    
        vector<vector<int>> subsets(vector<int>& nums) {
            dfs(nums, 0);
            return ans;
        }
    };